import request from "@/utils/request";

export function pageUsers(pageNum, pageSize, name) {
    return request({
        url: `/user/page?pageNum=${pageNum}&pageSize=${pageSize}&name=${name}`,
        method: 'get',
    })
}

export function addUser(user) {
    return request({
        url: `/user/add`,
        method: 'post',
        data: user
    })
}

export function updateUser(user) {
    return request({
        url: `/user/update`,
        method: 'put',
        data: user
    })
}

export function deleteUser(id) {
    return request({
        url: `/user/${id}`,
        method: 'delete',
    })
}

export function assignRole(userRole) {
    return request({
        url: `/user/assign`,
        method: 'post',
        data: userRole
    })
}

export function deleteRole(userRole) {
    return request({
        url: `/user/role/delete`,
        method: 'delete',
        data: userRole
    })
}
export function updateDetail(user) {
    return request({
        url: `/user/update/detail`,
        method: 'put',
        data: user
    })
}
